package entity;

import java.lang.reflect.Method;
import java.util.Random;

/**
 * @Author lzp
 * @Date 2024-03-25
 */
public class Student {
    private String name;
    private int age;
    private float weight;
    private static final double PI = 3.14;

    private double weights;

    private double score;

    private String address;

    private Double hour;

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

    public double getWeights() {
        return weights;
    }

    public void setWeights(double weights) {
        this.weights = weights;
    }

    public Student() {
    }

    public Student(String name, int age, float weight) {
        this.name = name;
        this.age = age;
        this.weight = weight;
    }

    public Student(String name, Float weight) {
        this.name = name;
        this.age = 18;
        this.weight = weight;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public float getWeight() {
        return weight;
    }

    public void setWeight(float weight) {
        this.weight = weight;
    }

    public void hello() {
        System.out.println("你好!");
    }

    private void sleep() {
        System.out.println("睡觉了！");
    }

    public void sayHello(String who) {
        System.out.println("你好," + who);
    }

    public int sum(int i, int j) {
        return i + j;
    }

    @Override
    public String toString() {
        return this.getName()+","+this.getAge()+","+this.getWeight() ;
    }

    public Student(String name, int age, double weights) {
        this.name = name;
        this.age = age;
        this.weights = weights;
    }

    public void show(){

        System.out.println("姓名"+this.name);
        System.out.println("年龄"+this.age);
        System.out.println("体重"+this.weights);



    }


    public Student(String name,Double score){
        this.name =name;
        this.score =score;
    }

    private int study(String address,Double hour) throws Exception {
        //int rand;
        //return rand = new Random().nextInt(100) + 1;


        System.out.println(this.name + "在" + address + "学习了" + hour + "个小时");
        Class<?> randomClass = Random.class;
        Object rand = randomClass.getConstructor().newInstance();
        Method nextInt = randomClass.getMethod("nextInt");
        Object date = nextInt.invoke(rand,100);
        if (date instanceof Integer){
            Integer jinYan = (Integer) date;
            return jinYan + 1;
        }

        return -1 ;
    }



    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Double getHour() {
        return hour;
    }

    public void setHour(Double hour) {
        this.hour = hour;
    }
}
